<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>adspygoogle.common.Utils</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="adspygoogle-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/google-api-dfp-python">DFP API Python Client Library</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="adspygoogle-module.html">Package&nbsp;adspygoogle</a> ::
        <a href="adspygoogle.common-module.html">Package&nbsp;common</a> ::
        Module&nbsp;Utils
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="adspygoogle.common.Utils-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module Utils</h1><p class="nomargin-top"><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html">source&nbsp;code</a></span></p>
<p>Handy utility functions.</p>

<hr />
<div class="fields">      <p><strong>Author:</strong>
        api.sgrinberg@gmail.com (Stan Grinberg)
      </p>
</div><!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#ReadFile" class="summary-sig-name">ReadFile</a>(<span class="summary-sig-arg">f_path</span>)</span><br />
      Load data from a given file.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#ReadFile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetDataFromCsvFile" class="summary-sig-name">GetDataFromCsvFile</a>(<span class="summary-sig-arg">loc</span>)</span><br />
      Get data from CSV file, given its location.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetDataFromCsvFile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetDictFromCsvFile" class="summary-sig-name">GetDictFromCsvFile</a>(<span class="summary-sig-arg">loc</span>)</span><br />
      Get data from CSV file as a dictionary, given its location.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetDictFromCsvFile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#PurgeLog" class="summary-sig-name">PurgeLog</a>(<span class="summary-sig-arg">log</span>)</span><br />
      Clear content of a given log file.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#PurgeLog">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetErrorFromHtml" class="summary-sig-name">GetErrorFromHtml</a>(<span class="summary-sig-arg">data</span>)</span><br />
      Return error message from HTML page.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetErrorFromHtml">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#IsHtml" class="summary-sig-name">IsHtml</a>(<span class="summary-sig-arg">data</span>)</span><br />
      Return True if data is HTML, False otherwise.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#IsHtml">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#DecodeNonASCIIText" class="summary-sig-name">DecodeNonASCIIText</a>(<span class="summary-sig-arg">text</span>,
        <span class="summary-sig-arg">encoding</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">utf-8</code><code class="variable-quote">'</code></span>)</span><br />
      Decode a non-ASCII text into a unicode, using given encoding.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#DecodeNonASCIIText">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#MakeTextXMLReady" class="summary-sig-name">MakeTextXMLReady</a>(<span class="summary-sig-arg">text</span>)</span><br />
      Convert given text into an XML ready text.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#MakeTextXMLReady">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr class="private">
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#__ParseUrl" class="summary-sig-name" onclick="show_private();">__ParseUrl</a>(<span class="summary-sig-arg">url</span>)</span><br />
      Parse URL into components.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#__ParseUrl">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetSchemeFromUrl" class="summary-sig-name">GetSchemeFromUrl</a>(<span class="summary-sig-arg">url</span>)</span><br />
      Return scheme portion of the URL.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetSchemeFromUrl">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetNetLocFromUrl" class="summary-sig-name">GetNetLocFromUrl</a>(<span class="summary-sig-arg">url</span>)</span><br />
      Return netloc portion of the URL.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetNetLocFromUrl">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetPathFromUrl" class="summary-sig-name">GetPathFromUrl</a>(<span class="summary-sig-arg">url</span>)</span><br />
      Return path portion of the URL.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetPathFromUrl">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetServerFromUrl" class="summary-sig-name">GetServerFromUrl</a>(<span class="summary-sig-arg">url</span>)</span><br />
      Return reconstructed scheme and netloc portion of the URL.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetServerFromUrl">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetAuthToken" class="summary-sig-name">GetAuthToken</a>(<span class="summary-sig-arg">email</span>,
        <span class="summary-sig-arg">password</span>,
        <span class="summary-sig-arg">service</span>,
        <span class="summary-sig-arg">lib_sig</span>,
        <span class="summary-sig-arg">proxy</span>)</span><br />
      Return an authentication token for Google Account.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetAuthToken">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetCurrentFuncName" class="summary-sig-name">GetCurrentFuncName</a>()</span><br />
      Return current function/method name.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetCurrentFuncName">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#UnLoadDictKeys" class="summary-sig-name">UnLoadDictKeys</a>(<span class="summary-sig-arg">dct</span>,
        <span class="summary-sig-arg">keys_lst</span>)</span><br />
      Return newly built dictionary with out the keys in keys_lst.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#UnLoadDictKeys">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#CleanUpDict" class="summary-sig-name">CleanUpDict</a>(<span class="summary-sig-arg">dct</span>)</span><br />
      Return newly built dictionary with out the keys that point to no values.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#CleanUpDict">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#BoolTypeConvert" class="summary-sig-name">BoolTypeConvert</a>(<span class="summary-sig-arg">bool_type</span>)</span><br />
      Convert bool to local bool and vice versa.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#BoolTypeConvert">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#LastStackTrace" class="summary-sig-name">LastStackTrace</a>()</span><br />
      Fetch last stack traceback.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#LastStackTrace">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#HtmlUnescape" class="summary-sig-name">HtmlUnescape</a>(<span class="summary-sig-arg">text</span>)</span><br />
      Removes HTML or XML character references and entities from a text string.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#HtmlUnescape">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#HtmlEscape" class="summary-sig-name">HtmlEscape</a>(<span class="summary-sig-arg">text</span>)</span><br />
      Escapes characters in a given text string.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#HtmlEscape">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#CsvEscape" class="summary-sig-name">CsvEscape</a>(<span class="summary-sig-arg">text</span>)</span><br />
      Escapes data entry for consistency with CSV format.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#CsvEscape">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetUniqueName" class="summary-sig-name">GetUniqueName</a>(<span class="summary-sig-arg">max_len</span>=<span class="summary-sig-default">None</span>)</span><br />
      Returns a unique value consisting of parts from datetime.datetime.now().</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetUniqueName">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="adspygoogle.common.Utils-module.html#GetDictFromMap" class="summary-sig-name">GetDictFromMap</a>(<span class="summary-sig-arg">entries</span>)</span><br />
      Gets a dictionary from an array of map entries.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetDictFromMap">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="ReadFile"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">ReadFile</span>(<span class="sig-arg">f_path</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#ReadFile">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Load data from a given file.

Args:
  f_path: str Absolute path to the file to read.

Returns:
  str Data loaded from the file, None otherwise.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetDataFromCsvFile"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetDataFromCsvFile</span>(<span class="sig-arg">loc</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetDataFromCsvFile">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get data from CSV file, given its location.

Args:
  loc: str Location of the CSV data file.

Returns:
  list Data from CSV file.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetDictFromCsvFile"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetDictFromCsvFile</span>(<span class="sig-arg">loc</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetDictFromCsvFile">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Get data from CSV file as a dictionary, given its location. For each row,
the first value will be used as a key mapped to the second value in the row.

Args:
  loc: str Location of the CSV data file.

Returns:
  dict Data from CSV file.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="PurgeLog"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">PurgeLog</span>(<span class="sig-arg">log</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#PurgeLog">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Clear content of a given log file.

If the file cannot be opened, Error is raised.

Args:
  log: str Absolute path to a log file.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetErrorFromHtml"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetErrorFromHtml</span>(<span class="sig-arg">data</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetErrorFromHtml">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return error message from HTML page.

Args:
  data: str HTML data.

Returns:
  str Error message.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="IsHtml"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">IsHtml</span>(<span class="sig-arg">data</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#IsHtml">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return True if data is HTML, False otherwise.

Args:
  data: str Data to check.

Returns:
  bool True if data is HTML, False otherwise.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="DecodeNonASCIIText"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">DecodeNonASCIIText</span>(<span class="sig-arg">text</span>,
        <span class="sig-arg">encoding</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">utf-8</code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#DecodeNonASCIIText">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Decode a non-ASCII text into a unicode, using given encoding.

A full list of supported encodings is available at
http://docs.python.org/lib/standard-encodings.html. If unable to find given
encoding, Error is raised.

Args:
  text: str Text to encode.
  [optional]
  encoding: str Encoding format to use.

Returns:
  tuple Decoded text with the text length, (text, len(text)).

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="MakeTextXMLReady"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">MakeTextXMLReady</span>(<span class="sig-arg">text</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#MakeTextXMLReady">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Convert given text into an XML ready text.

XML ready text with all non-ASCII characters properly decoded.

Args:
  text: str Text to convert.

Returns:
  str Converted text.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="__ParseUrl"></a>
<div class="private">
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">__ParseUrl</span>(<span class="sig-arg">url</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#__ParseUrl">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Parse URL into components.

Args:
  url: str URL to parse.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetSchemeFromUrl"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetSchemeFromUrl</span>(<span class="sig-arg">url</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetSchemeFromUrl">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return scheme portion of the URL.

Args:
  url: str URL to parse.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetNetLocFromUrl"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetNetLocFromUrl</span>(<span class="sig-arg">url</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetNetLocFromUrl">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return netloc portion of the URL.

Args:
  url: str URL to parse.

Returns:
  str Netloc portion of the URL.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetPathFromUrl"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetPathFromUrl</span>(<span class="sig-arg">url</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetPathFromUrl">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return path portion of the URL.

Args:
  url: str URL to parse.

Returns:
  str Path portion of the URL.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetServerFromUrl"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetServerFromUrl</span>(<span class="sig-arg">url</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetServerFromUrl">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return reconstructed scheme and netloc portion of the URL.

Args:
  url: str URL to parse.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetAuthToken"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetAuthToken</span>(<span class="sig-arg">email</span>,
        <span class="sig-arg">password</span>,
        <span class="sig-arg">service</span>,
        <span class="sig-arg">lib_sig</span>,
        <span class="sig-arg">proxy</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetAuthToken">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return an authentication token for Google Account.

If an error occurs, AuthTokenError is raised.

Args:
  email: str Google Account's login email.
  password: str Google Account's password.
  service: str Name of the Google service for which to authorize access.
  lib_sig: str Signature of the client library.
  proxy: str HTTP proxy to use.

Returns:
  str Authentication token for Google Account.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetCurrentFuncName"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetCurrentFuncName</span>()</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetCurrentFuncName">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return current function/method name.

Returns:
  str Current function/method name.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="UnLoadDictKeys"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">UnLoadDictKeys</span>(<span class="sig-arg">dct</span>,
        <span class="sig-arg">keys_lst</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#UnLoadDictKeys">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return newly built dictionary with out the keys in keys_lst.

Args:
  dct: dict Dictionary to unload keys from.
  keys_lst: list List of keys to unload from a dictionary.

Returns:
  dict New dictionary with out given keys.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="CleanUpDict"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">CleanUpDict</span>(<span class="sig-arg">dct</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#CleanUpDict">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Return newly built dictionary with out the keys that point to no values.

Args:
  dct: dict Dictionary to clean up.

Returns:
  dict New dictionary with out empty keys.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="BoolTypeConvert"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">BoolTypeConvert</span>(<span class="sig-arg">bool_type</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#BoolTypeConvert">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Convert bool to local bool and vice versa.

Args:
  bool_type: bool or str a type to convert (i.e. True&lt;=&gt;'y', False&lt;=&gt;'n',
             'true'=&gt;True, 'false'=&gt;False).

Returns:
  bool or str converted type.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="LastStackTrace"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">LastStackTrace</span>()</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#LastStackTrace">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Fetch last stack traceback.

Returns:
  str Last stack traceback.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="HtmlUnescape"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">HtmlUnescape</span>(<span class="sig-arg">text</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#HtmlUnescape">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Removes HTML or XML character references and entities from a text string.

See http://effbot.org/zone/re-sub.htm#unescape-html.

Args:
  text: str HTML (or XML) source text.

Returns:
  str/unicode Plain text, as a Unicode string, if necessary.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="HtmlEscape"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">HtmlEscape</span>(<span class="sig-arg">text</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#HtmlEscape">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Escapes characters in a given text string.

See http://wiki.python.org/moin/EscapingHtml.

Args:
  text: str Text to HTML escape.

Returns:
  str HTML escaped string.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="CsvEscape"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">CsvEscape</span>(<span class="sig-arg">text</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#CsvEscape">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Escapes data entry for consistency with CSV format.

The CSV format rules:
  - Fields with embedded commas must be enclosed within double-quote
    characters.
  - Fields with embedded double-quote characters must be enclosed within
    double-quote characters, and each of the embedded double-quote characters
    must be represented by a pair of double-quote characters.
  - Fields with embedded line breaks must be enclosed within double-quote
    characters.
  - Fields with leading or trailing spaces must be enclosed within
    double-quote characters.

Args:
  text: str Data entry.

Returns:
  str CSV encoded data entry.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetUniqueName"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetUniqueName</span>(<span class="sig-arg">max_len</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetUniqueName">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Returns a unique value consisting of parts from datetime.datetime.now().

Args:
  max_len: int Maximum length for the unique name.

Returns:
  str Unique name.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="GetDictFromMap"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">GetDictFromMap</span>(<span class="sig-arg">entries</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="adspygoogle.common.Utils-pysrc.html#GetDictFromMap">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">
Gets a dictionary from an array of map entries. A map entry is any object
that has a key and value fields.

Args:
  entries: list List of map entries.

Returns:
  dict Dictionary constructed from map entries.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="adspygoogle-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/google-api-dfp-python">DFP API Python Client Library</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
